import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/drama_banner_entity.dart';

DramaBannerEntity $DramaBannerEntityFromJson(Map<String, dynamic> json) {
  final DramaBannerEntity dramaBannerEntity = DramaBannerEntity();
  final int? dramaId = jsonConvert.convert<int>(json['drama_id']);
  if (dramaId != null) {
    dramaBannerEntity.dramaId = dramaId;
  }
  final String? dramaName = jsonConvert.convert<String>(json['drama_name']);
  if (dramaName != null) {
    dramaBannerEntity.dramaName = dramaName;
  }
  final String? bannerImg = jsonConvert.convert<String>(json['banner_img']);
  if (bannerImg != null) {
    dramaBannerEntity.bannerImg = bannerImg;
  }
  final int? recSort = jsonConvert.convert<int>(json['rec_sort']);
  if (recSort != null) {
    dramaBannerEntity.recSort = recSort;
  }
  return dramaBannerEntity;
}

Map<String, dynamic> $DramaBannerEntityToJson(DramaBannerEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['drama_id'] = entity.dramaId;
  data['drama_name'] = entity.dramaName;
  data['banner_img'] = entity.bannerImg;
  data['rec_sort'] = entity.recSort;
  return data;
}

extension DramaBannerEntityExtension on DramaBannerEntity {
  DramaBannerEntity copyWith({
    int? dramaId,
    String? dramaName,
    String? bannerImg,
    int? recSort,
  }) {
    return DramaBannerEntity()
      ..dramaId = dramaId ?? this.dramaId
      ..dramaName = dramaName ?? this.dramaName
      ..bannerImg = bannerImg ?? this.bannerImg
      ..recSort = recSort ?? this.recSort;
  }
}